home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 395 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  82 lines

  1. Path: sn.no!usenet
  2. From: Componen@sn.no (Dag Stσle Bakken)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Urgent! Need help in Boralnd C++ 3.1
  5. Date: Thu, 04 Jan 1996 10:48:49 GMT
  6. Organization: Component-74 Eidsvold AS
  7. Message-ID: <4cg7au$o3j@hasle.sn.no>
  8. References: <30EC0650.185B@cuhk.hk>
  9. Reply-To: Componen@sn.no
  10. NNTP-Posting-Host: fp5-ppp13.oslo.net
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. Eric Wong <b721742@cuhk.hk> wrote:
  14.  
  15. >Help! How can I add the double click event in my application which is 
  16. >written by Borland C++ 3.1!
  17.  
  18. The example below will execute the function "FunctionName" when the
  19. application receives a message concerning the control with ID number
  20. 402.  The function "FunctionName" will check if the message is a
  21. double-click from a ListBox.  If 'TRUE', execute function
  22. "AnotherFunction" to do some action of your choice.  (Perhaps load or
  23. save a file ?)
  24.  
  25. class MyClass : public TDialog  //'TDialog' or 'TWindow' or whatever
  26. {
  27. public:
  28.  
  29. /* Some definitions */
  30.  
  31.   virtual void AnotherFunction();
  32.   virtual void FunctionName(RTMessage Msg)    = [ID_FIRST + 402]
  33.   { if (Msg.LP.Hi!=LBN_DBLCLK) return;
  34.     AnotherFunction(); };
  35.  
  36. /* More definitions */
  37.  
  38. };
  39.  
  40. void MyClass::AnotherFunction()
  41. {
  42. //  Do something
  43. }
  44.  
  45. If you want this example to respond to one of the 'WM_XXXX' messages
  46. below, the function dispatch number [ID_FIRST + 402] must be exchanged
  47. with [WM_FIRST + {message}].  {message} is one of the 'WM' messages
  48. below.
  49.  
  50.  
  51. This example may be optimized in a big way, but in this form it's
  52. quite understandable (I hope).
  53.  
  54.  
  55. BN_DOUBLECLICKED   Indicates the user double-clicked a button 
  56. CBN_DBLCLK         Indicates the user double-clicked a string in
  57.                    a ComboBox.
  58. LBN_DBLCLK         Indicates that the user double-clicked a string
  59.                    in a ListBox.
  60.  
  61. WM_COMMAND         Specifies a command message 
  62. WM_LBUTTONDBLCLK   Indicates double-click of left mouse button 
  63. WM_LBUTTONDOWN     Indicates when left mouse button is pressed 
  64. WM_LBUTTONUP       Indicates when left mouse button is released 
  65. WM_MBUTTONDBLCLK   Indicates double-click of middle mouse button 
  66. WM_MBUTTONDOWN     Indicates when middle mouse button is pressed 
  67. WM_MBUTTONUP       Indicates when middle mouse button is released 
  68. WM_NCLBUTTONDBLCLK Indicates non-client left button double-click 
  69. WM_NCLBUTTONDOWN   Indicates left button pressed in nonclient area 
  70. WM_NCLBUTTONUP     Indicates left button released in nonclient area 
  71. WM_NCMBUTTONDBLCLK Indicates middle button nonclient double-click 
  72. WM_NCMBUTTONDOWN   Indicates middle button pressed in nonclient area 
  73. WM_NCMBUTTONUP     Indicates middle button released in nonclient area 
  74. WM_NCRBUTTONDBLCLK Indicates right button nonclient double-click 
  75. WM_NCRBUTTONDOWN   Indicates right button pressed in nonclient area 
  76. WM_NCRBUTTONUP     Indicates right button released in nonclient area 
  77. WM_RBUTTONDBLCLK   Indicates a double-click of right mouse button 
  78. WM_RBUTTONDOWN     Indicates when the right mouse button is pressed 
  79. WM_RBUTTONUP       Indicates when the right mouse button is released 
  80.  
  81.  
  82.